Real Time Trigger Using A Finite State Machine Having A Counting State

ABSTRACT

An apparatus that searches for a pattern in a signal is disclosed. The apparatus can be used to implement a real time trigger in an instrument such as a high speed oscilloscope. The apparatus includes a symbol generator and a finite state machine (FSM). The symbol generator receives an ordered sequence of signal values and converts the ordered sequence of signal values into an ordered sequence of symbols, each symbol having a plurality of states. The FSM receives the ordered sequence of symbols and generates a match signal if the ordered sequence of symbols includes a target sequence specified by a regular expression that includes a counting limitation on one of the symbol states. The FSM includes a counting state that includes a counter that counts instances of the one of the symbol states.

BACKGROUND

Measurement instruments that measure, record, process a signal, anddisplay the results of the processing are known to the art. For example,a digital oscilloscope measures the amplitude of a signal as a functionof time and displays a portion of the observed signal as a graph ofsignal amplitude as a function of time. Modern digital oscilloscopes canmeasure a signal at a rate of close to 100 Gigasamples/second in each ofa plurality of measurement channels. To generate data at this rate, thesignal is typically digitized using a bank of sample and hold circuitsthat sample the signal in successive time slots. Each sample and holdcircuit feeds a high speed analog-to-digital converter (ADC) that storesits output in a high speed memory bank that is assigned to that ADC.

Only a small fraction of this data is typically of interest. Hence, someform of “trigger” is utilized to define the beginning of a region ofinterest in the signal. When the trigger is detected, the instrumentrecords the signal from the trigger to some point in time that dependson the storage capacity of the memory banks. Simple triggers such asdetecting a rising edge in the signal can be implemented in hardware inreal time. A trigger system that can consume samples as fast as the bankof ADCs can generate the samples will be referred to as a real timetrigger system. However, more complex triggers must rely on storing adata sequence and then examining the sequence using hardware that is tooslow to operate in real time. In such schemes, a real time trigger isused to define some preliminary trigger event. The instrument thenrecords the data from that trigger point to some predetermined number ofsamples. The recorded data is then examined by a more complex triggersystem to determine if the more complex trigger is present. Suchsecondary trigger systems are referred to as post acquisition triggers(PATs). If the complex trigger is found, the instrument displays thedata starting with that trigger. If the complex trigger pattern is notfound, the process is repeated. During the time the PAT is operating onthe stored data, the instrument is not acquiring any new data, andhence, the instrument is “blind” for that period of time. The blind timeis typically a large fraction of the total operating time, and hence, asignal of interest can be lost.

In co-pending U.S. patent application Ser. No. 14/313,884, a scheme forusing finite state machines (FSMs) to implement a trigger system forcomplex trigger criteria is disclosed. In that invention, the digitizedsignal values are first converted to a sequence of symbols that havemuch fewer states than the digitized signal values. For example, a 12bit ADC-generated value can be reduced to three symbols, L, M, and H bycomparing the signal values to three ranges of values. A trigger isdefined as a sequence in the symbol sequence that satisfies apredetermined regular expression. The FSM-implemented trigger systemoperates on the resultant sequence of symbols. Many triggers of interestcan be expressed as patterns on these symbols. Since the number ofstates is small, the memory requirements for the resultant FSM aresignificantly reduced. To achieve real time processing speeds, FSMs thatoperate on words having a plurality of symbols in each word are used, sothat the number of symbols consumed in each clock cycle matches the rateat which the symbols are generated by the ADCs. Even in systems in whichthe rate of consumption is less that that required for real timeprocessing, the processing time can be reduced from that associated withPATs, and hence, the blind time is significantly reduced. Triggeringsystems that implement triggers in which the trigger pattern isspecified in terms of the time a symbol is repeated present significantchallenges. The present invention is directed to systems forimplementing such triggers.

SUMMARY OF THE INVENTION

The present invention includes an apparatus that searches for a patternin a signal. The apparatus includes a symbol generator and an FSM. Thesymbol generator receives an ordered sequence of signal values andconverts the ordered sequence of signal values into an ordered sequenceof symbols, each symbol having a plurality of states. The FSM receivesthe ordered sequence of symbols and generates a match signal if theordered sequence of symbols includes a target sequence specified by aregular expression that includes a counting limitation on one of thesymbol states. The FSM includes a counting state that includes a counterthat counts instances of the one of the symbol states.

In one aspect of the invention, the FSM is characterized by an inputword and an FSM clock period. The FSM processes one input word duringeach FSM clock period, and the input words includes a plurality of thesymbols.

In another aspect of the invention, the counting limitation includes arequirement that a precise number of instances of one of the symbolstates be present in the target sequence. In yet another aspect of theinvention, the counting limitation includes a requirement that more thana specified number of instances of one of the symbol states be presentin the target sequence. In a still further aspect of the invention, thecounting limitation includes a requirement that more than a firstspecified number of the instances of one of the symbol states and lessthan a second specified number of the instances of the one of thesymbols be present in the target sequence.

In another aspect of the invention, the FSM has a memory that stores astate table that specifies a next state for the FSM based on a presentstate for the FSM, and the input word currently is processed by the FSM.The state table specifies first and second next states for the FSM whenthe FSM is in the counting state. The FSM chooses one of the first andsecond next states based on whether the counting limitation has beensatisfied. In a further aspect of the invention, the counting limitationis not satisfied if the counter has a value less than a first value orgreater than a second value, and the one of the first and second statesthat the FSM chooses also depends on whether the counter is less thanthe first value or greater than the second value.

In yet another aspect of the invention, the apparatus also includes asignal digitizer and a signal memory, the signal generator receiving asignal and generating the ordered sequence of signal values therefrom.The ordered sequence of signal values is stored in the signal memory. Inone aspect of the invention, the signal digitizer generates a firstnumber of signal values during each FSM clock period, each of the firstnumber of signal values being converted to a corresponding symbol duringone FSM clock period. The FSM processes the first number of symbols as asingle input word during one FSM clock period.

In a still further aspect of the invention, the apparatus includes adisplay controller and a display, the display controller displaying aportion of the signal values on the display in response to the FSMgenerating the match signal.

In yet another aspect of the invention, the FSM is a Mealy FSM.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 illustrates a digital oscilloscope system that utilizes anFSM-based trigger system to implement a real time trigger.

FIG. 2 illustrates an FSM that searches for regular expression[̂L]*L+M*H{3,4} M*L.

FIG. 3A illustrates the state diagram for a counter extended FSM fordetecting the glitch sequence [̂L]*L+M*H{m} M*L.

FIG. 3B illustrates the state diagram for a counter extended FSM fordetecting the glitch sequence [̂L]*L+M*H{m,} M*L.

FIG. 3C illustrates a counter extended FSM for the glitch sequence[̂L]*L+M*H{m,n} M*L.

FIG. 4 illustrates a base FSM for a two symbol input word that searchesfor the sequence shown in FIG. 3A.

FIG. 5 illustrates the portion of the hardware that implements an FSMaccording to the present invention.

FIG. 6 illustrates a base FSM for a two symbol input word FSM thatcounts an odd number of Hs.

DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS OF THE INVENTION

The manner in which the present invention provides its advantages can bemore easily understood with respect to an exemplary system that utilizesa trigger system based on the symbol system discussed above. Refer nowto FIG. 1, which illustrates a digital oscilloscope system that utilizesan FSM-based trigger system to implement a real time trigger (RTT). Theinput to digital oscilloscope 10 is digitized by a bank of ADCs 12. Toprovide sufficient time resolution, each ADC includes a sample and holdcircuit that has a very narrow sampling window. The window is muchshorter than the time needed to digitize the captured sample value.Hence, a bank of ADCs is utilized in which successive ADCs in the bankcapture signal values that are displaced in time from one another so asto provide a continuous series of samples separated by the width of thesampling window in time.

The output from each ADC is stored in a corresponding memory bank inmemory 14. The details of the banking of the ADCs and the banks in thememory have been omitted from the drawing to simplify the drawing andfollowing discussion. The ADC output is monitored by a symbol generator15 that generates a symbol from each ADC measurement. The symbols arethen inputted to trigger generator 16. If trigger generator 16 finds amatch to the trigger sequence, display controller 19 displays thecorresponding ADC measurements on display 20 starting from a pointdefined by the trigger sequence.

To simplify the following discussion, it will be assumed that each inputsignal value is converted to a symbol set having only three states, L,M, and H. A signal value that is less than a first threshold value isassigned the symbol L; a signal value that is between the firstthreshold and less than or equal to a second threshold is assigned thesymbol M, and signal values that are greater than the second thresholdare assigned the symbol H.

The trigger patterns that can be defined in the present invention arelimited to patterns that can be defined by regular expressions. For thepurposes of the present discussion, a regular expression is defined tobe a sequence of characters that defines a search pattern. Given aregular expression, an FSM that executes the search so defined exists,and there are procedures for automatically generating that FSM. Itshould also be noted that there is more than one FSM that is capable ofperforming the search for any given regular expression.

An FSM is a machine that has a plurality of states connected by“directed edges”. At each processing cycle, the FSM moves from itscurrent state to a next state when a new input word is received by theFSM. Hence, each edge has one or more input values associated with thatedge. When the FSM receives an input word having a value equal to thevalue corresponding to an edge, and the FSM is in the state associatedwith the input side of the edge, the FSM changes to the state associatedwith the output side of the edge. The FSM then proceeds to process thenext input word. Certain transitions give rise to the FSM reporting amatch that includes information associated with the transition. Thetransition may be the entry into a particular state or the entry intothat state by a specified edge. For the purposes of the presentdiscussion, the processing cycle is complete when the FSM has moved toits new state and made any required reports.

As noted above, a regular expression is defined to be a sequence ofcharacters that defines a search pattern. Each character in theexpression is either a regular character with its literal meaning or oneof a predetermined number of metacharacters that have a special meaning.For example, the metacharacter “|” denotes an alternative. The regularexpression “a|b” is satisfied by a or b. The metacharacters “?”, “*”,and “+” quantify the preceding element. Metacharacter “?” is satisfiedif the preceding element occurs zero or one time, “*” is satisfied ifthe preceding element occurs zero or more times, and “+” is satisfied ifthe preceding element occurs one or more times. Many patterns ofinterest require the repetition of some string. The expression that isto be repeated is surrounded (grouped) by ( ) if there is more than onecharacter, or more than one character range in the expression.Metacharacters “[” and “]” are used to create character classes, such as[LMH], “̂” is used to represent negation, i.e., [̂L], everything but ‘L’.To specify that the expression is to be repeated m times, {m} is usedafter the expression. To specify an expression that is to be repeated atleast m times, {m,} is used after the expression. To specify a rangebetween n and m, the expression is followed by {m,n}.

In terms of this notation, a regular expression for a rising edge is“L+M*H”, i.e., one or more Ls followed by zero or more Ms followed by anH. Similarly, a regular expression for a falling edge is “H+M*L”. Aregular expression for either a rising or falling edge is(H+M*L)|(L+M*H). Additional features of interest in defining triggersequences are state transitions, glitches, and runt pulses. A statetransition occurs when the waveform, having been established in one ofthe logic states, switches to the other state and becomes establishedthere. A glitch occurs when the waveform, having been established in onelogic state, switches to the other state, but not long enough to beconsidered established. A runt pulse occurs when the waveform, havingbeen established in one logic state, moves into the indeterminate regionbut then returns to the first logic state without ever having crossedthe other logic state threshold.

One challenge that must be overcome to provide practical triggers usingFSMs is creating space efficient counters for use in the triggers. Forexample, a glitch trigger, must only trigger when the width of the pulseis less than a certain time. Similarly, an edge followed by a secondedge should only trigger when the time between the edges is a greaterthan a predetermined time. In a digital oscilloscope, or other similarinstruments based upon ADCs, the amount of time passed between events ofinterest is equivalent to the number of samples. For example, at 1Gigasample/second, a sample is generated every nanosecond, and hence,the passage of time is equivalent to counting the number of samples.

For example, a glitch trigger can be defined by the regular expression[̂L]*L+M*H{3,4} M*L. That is, zero or more symbols that are not L, i.e.,M or H, followed by one or more L followed by zero or more M, followedby between three and four Hs followed by zero or more Ms and an L. Refernow to FIG. 2, which illustrates an FSM that searches for this regularexpression. The final reporting state is indicated by the double circlearound the state. In this example, the counting feature is implementedby inserting additional states into the FSM, namely states S3-S5. Thisis a viable approach for small values of the counter. At 1Gigasample/second, this FSM will trigger on a glitch having a widthbetween 3 ns and 4 ns. However, this approach is not efficient when thecount is significantly larger. For example, a glitch that is defined asbeing in the high state for a microsecond would require a thousandstates.

A second problem relates to the need to match the processing rate of thetrigger generator to the rate at which the input signal is being sampledand digitized. Consider a system in which samples are digitized at arate of 6.4 Gigasamples/second. An FSM implemented in a programmablegate array is limited to running at a clock rate of 400 MHz. Hence, theFSM must operate on an input word that is 16 samples wide to keep upwith the ADC bank. Counting symbols presents significant challenges whenthe word size processed by the FSM is large. A wide word FSM must beable to recognize data changes at any alignment in the incoming data.For simplicity, consider a four word system where four symbols arrive oneach FSM clock edge. Consider the regular expression discussed above fora glitch that is required to count H symbols. The FSM must be able todetect the sequence of Hs independent of the alignment of the symbols inthe four-symbol input word. That is, the input word that commences astring of Hs could be ‘LMMH’ followed by four words of ‘HHHH’ followed‘HMML’, i.e., 18 ‘H’ symbols. However, the same sequence could arrive ona different word boundary such as ‘LMHH’ then four lots of ‘HHHH’ then‘MMML’. This is also 18 ‘H’ symbols but on a different alignment. Hence,any mechanism for counting a symbol must deal with all of the possiblealignments of the symbol sequence within the multi-symbol input words.

A third problem that must be overcome with multiple symbol input wordsis the need to count samples, not FSM clock cycles. If the word size isone and the FSM consumes one symbol per clock cycle, then counting clockcycles of the FSM is equivalent to counting samples. When the number ofsymbols per FSM clock cycle is greater than one, counting FSM clockcycles is equivalent to counting multiple samples.

A fourth problem that must be overcome is the need for the FSM toconsume a multi-symbol word every FSM clock cycle. Hence, the hardwarecannot take two or more clock cycles to make a transition. The FSM mustbe able to calculate the next state in a single FSM clock cycle and oneach and every subsequent FSM clock cycle.

Finally, the counting hardware must support the different styles ofcounters. There are three fundamentally different styles of counting inregular expressions.

-   1. [m] match exactly m times-   2. [m,] match at least m times-   3. [m,n] match at least m times but no more than n times

The first problem can be solved by using an extended FSM that includes acounting function associated with one or more states. Such states willbe referred to as counting states in the present discussion. Eachcounting state has a counter associated with that state. The counter isreset to a particular value when the FSM enters that counting state. Thecount is incremented or decremented each time a particular input word isinput to the FSM when the FSM is in that counting state. The choice ofthe next state executed by the FSM upon receiving a particular inputword when the FSM is in the counting state depends on the count in thecounter at the time the input word is received. In general, there willbe one set of edges leaving the counting state if the count satisfies apredetermined condition, and there will be another set of edgescorresponding to the case in which the count does not satisfy thiscondition. In the following discussion, the predetermined condition willbe referred to as the count satisfied condition.

To simplify the following discussion, each of the counting stylesdiscussed above will be discussed with reference to FSMs in which onlyone symbol is processed at each FSM clock cycle. The manner in whichthese FSMs can be utilized to define an FSM for a multi-symbol inputword will then be discussed.

Refer now to FIG. 3A, which illustrates the state diagram for a counterextended FSM for detecting the glitch sequence [̂L]*L+M*H{m} M*L. In thisembodiment, state S3 references a counter that is initially loaded withthe value m-1 when the trigger is armed. Each time S3 is entered inresponse to an input of H, the counter is decremented by 1. The countsatisfied condition for this case is C=0, where C is the count in theassociated counter. The next state upon the receipt of a symbol by S3now depends not only on that symbol, but also on the state of thecounter after any decrement operation has been completed. If the countsatisfied condition is met, the next state is the state transition shownby the solid line edges leaving S3. If the count satisfied condition isnot met, the transitions shown by the dotted edges are taken. A statetable for the FSM in FIG. 3A is shown in Table 1 which shows the nextstate as a function of the current state, input symbol, and whether ornot the count satisfied condition has been met. For reasons that will beexplained in more detail below, a next state as a function of thecounter value is provided even for states that do not reference thecounter so that all states have the same format. The next state valuesfor the cases in which the count satisfied condition has not been metare shown in the columns marked “×”. The next state values for the casesin which the count satisfied condition has been met are shown in thecolumns marked “✓”.

TABLE 1 State Table for [{circumflex over ( )}L] * L + M * H{m}M * L.Current state S5 S0 S1 S2 S3 S4 (Match) Input x ✓ x ✓ x ✓ x ✓ x ✓ x ✓ L1 1 1 1 5 5 — M 0 2 2 0 4 4 — H 0 3 3 3 0 0 —

In the above example, there is only one counter, and hence, the identityof the counter does not need to be shown. However, in many cases ofinterest, there will be multiple counters. Hence, the identity of thecounter corresponding to each state is stored in the state table or anassociated table.

Refer now to FIG. 3B which illustrates the state diagram for a counterextended FSM for detecting the glitch sequence [̂L]*L+M*H{m,} M*L. Inthis case, the count satisfied condition is that at least m Hs have beenreceived. If the count condition has not been satisfied and an H isreceived, S3 continues to loop. Once the count satisfied condition hasbeen met, S3 will still loop on receiving an H. Since the patternrequires “at least” m Hs, there can be more; hence, there are twolooping transitions shown in the figure.

TABLE 2 State Table for [{circumflex over ( )}L] * L + M * H{m,}M * L.Current state S5 S0 S1 S2 S3 S4 (Match) Input x ✓ x ✓ x ✓ x ✓ x ✓ x ✓ L1 1 1 1 5 5 — M 0 2 2 0 4 4 — H 0 3 3 3 3 0 —

The third type of counting style presents additional challenges.Consider the glitch sequence [̂L]*L+M*H{m,n} M*L. The count condition issatisfied when the counter value is greater than or equal to m and lessthan or equal to n. There are two cases in which this condition is notmet. The first corresponds to the count being less than m, and thesecond corresponds to the count being greater than n. If an H isreceived during the first case, the state loops back to itself and thecount is incremented or decremented, as the condition could still bemet. In the second case, the FSM returns to S0, i.e., the search failed.During the operation in which the condition is met, an H causes a loopback to S3. Hence, there are three different cases for an H when the FSMis in state S3. Refer now to FIG. 3C, which illustrates a counterextended FSM for the glitch sequence, [̂L]*L+M*H{m,n} M*L. If the countis less than m, and an H is received, the count condition is notsatisfied and the edge loops back to S3, as shown by the dotted loop onS3. If the count is greater than n, the edge marked H′ is taken. If thecount is between m and n, the count satisfied condition is met, and anadditional H is merely added to the count as indicated by the solid loopback to S3.

These two distinct not satisfied modes could in principle beaccommodated by adding a third column to the state table. Thedetermination of which not satisfied column is used would then bedetermined by a flag that is set on entering S3 the first time and reseton the count being greater than n. As will be explained in more detailbelow, it is advantageous to use the same format for all columns in thestate table. Hence, adding a third column to the state table for thecounted states would require adding a third column to the table for allof the states. This would significantly increase the memory required forthe state table. As will be discussed in more detail below, minimizingthe memory requirement of the state table is important in terms ofmaximizing the number of symbols that can be processed at each FSM clockcycle. Hence, this method of accommodating the two different notsatisfied possibilities is not preferred.

In one aspect of the present invention, the additional column in thestate tables is avoided by noting that there are only two “next states”in the table for an H, even though there are three possible cases for S3when an H is received. The first next state is 0, and the second nextstate is S3, i.e., a loop back to S3. In this case, two flags aredefined. The first indicates whether the count condition is satisfied,the second indicates whether the fail condition corresponds to the countbeing too low or too high. For the purposes of this example, the secondflag will be denoted by f and will be defined to be true if the count isless than m. When the count reaches m, f is set to false. A state tableis constructed corresponding to one of the fail conditions, in thiscase, the flag being true. The next state in this fail case is S3. Theother possible next state, S0, is stored in the H row of the conditionsatisfied column, even though this is not the correct next state forthat location in the state table. However, the FSM is programmed toreverse the entries in the condition not satisfied and conditionsatisfied columns if the flag is true. Hence, when the condition issatisfied, the correct next state, S3, will be used. When the countexceeds n, the flag is reset, and hence, the value in the countsatisfied column is used for H, even though the count is not actuallysatisfied. It should be noted that the state table based on this flag isshown below.

TABLE 3 State Table for [{circumflex over ( )}L] * L + M * H{m, n}M * L.Current state S5 S0 S1 S2 S3 S4 (Match) Input x ✓ x ✓ x ✓ x ✓ x ✓ x ✓ L1 1 1 1 5 5 — M 0 2 2 0 4 4 — H 0 3 3 3(f) 0(f) 0 —It should be noted that the entry for H and the count conditionsatisfied will never be taken while f is true, hence, the value storedthere has no effect on the operation of the FSM. When the count reachesm, f is set to false, and hence the column entries for H are reversed.

In summary, the state tables for any of the three counting styles can beconstructed by having at lease two columns for the counting state. Thechoice of column is determined by a first flag that indicates whetherthe count satisfied condition has been met. In some cases, a second flagthat indicates the manner in which the count satisfied condition has notbeen met is needed. This flag can be used in conjunction with a thirdcolumn to pick the next state by selecting which of the count conditionnot satisfied next states is the correct one. In some cases, the thirdcolumn can be eliminated by using the second flag to reverse the entriesin the two column table depending on the manner in which the countcondition is not satisfied.

The above-described embodiments allow the counting function to beimplemented without significantly increasing the number of states in theFSM. The computational engine needs to have one counter for eachcounting function in the regular expression that is operative at anygiven time. In addition, the state table must be expanded to include anentry for each count enhanced state to provide the next state for thetwo different count possibilities. One provides the next state if thecount is satisfied, and one provides the next state if the count has notbeen satisfied. The above-described embodiments are single trigger FSMsin that once the reporting state is achieved, the trigger stopsfunctioning until it is reset. Embodiments in which the trigger operatesin a continuous manner will be discussed in more detail below.

While the above-described embodiments provide improvements overembodiments in which a new state is added for each possible count in aregular expression, these embodiments still only process one symbol perFSM cycle. To provide a significant speed improvement in finding thetarget sequence, an FSM that processes multiple samples per FSM clockcycle is required.

One method for constructing a state table for a multi-symbol FSM thatincludes counting states and searches for a sequence that satisfies somepredetermined regular expression starts from an FSM that processes onesymbol per FSM clock cycle and searches for the sequence in question.Using this one symbol FSM, an intermediate one symbol FSM is constructedby expanding the counting states in the one symbol FSM. This expandedFSM will be referred to as a base FSM for an FSM that processes wsymbols at each cycle. The base FSM is a construct that allows one toconstruct the state table for the multi-symbol FSM.

To generate a base FSM for a multiple symbol input word, the base FSMfor a single symbol input word must first be expanded. The expansionintroduces additional counted states for each counted state in thesingle symbol input word FSM. After the expansion, the number of countedstates corresponding to a given counted state in the single symbol FSMis equal to the number of symbols in the input word. Each counted statecorresponds to a different alignment of the counted symbols within theinput word when the counted state is entered.

Consider a two symbol input word for the sequence shown in FIG. 3A. Thebase FSM for this case is shown in FIG. 4. State S3 is expanded into twostates, S3A and S3B. The state counting H input symbols could be enteredin response to an input word XH, or HH, where X is either L or M. State3A counts H strings that enter via input words of the form XH. Thiscounter will be referred to as the odd count state. State S3B counts Hstrings that enter via an input word of HH. This state will be referredto as the even count state. Once a given counting state has beenentered, there are three possibilities. The next input word could be HX,HH, or XX′, where X′ can be either L or M. If XX′ is received, by eitherstate, the count fails by definition. So only the first twopossibilities need to be examined. Consider the case in which HX isreceived by the odd counter, S3A. The counters in the base FSM eachcount in units of two. On entry into S3A, the counter is reset to thevalue corresponding to a count of m, namely m/2-1. This reset operationis indicated by the (r=m) tag on the edge in question. On entering theodd state via an H, one count was in effect registered, even though onlyone H of the pair has been seen. In essence, the state owes one H toactually complete the count. Hence, the counter will either have justreached the desired count on the last HH input word or it is still inneed of processing a further HH to complete the count. In the latercase, the fail transition is taken, since the X was received before thedesired count was obtained. In the former case, the state table willhave an exit transition for the next H. In effect, the H completes themissing symbol from the first pair. Hence, the odd counter will have anoutput edge on count satisfied for any word of the form HX. State S3B isentered in response to an input word of HH. This counter is likewisereset to the value corresponding to m.

While the base FSM has two counted states, these states can beimplemented using a single counter, since only one of the states will beoperative at any given time. If two different counters are used, thenthe counter for state 3B must be reset to zero on entry from the edgeconnecting S3A to S3B. This guarantees that S3B will not start countingany additional Hs instead of taking the failed edge on another H. If asingle counter is used, then the counter that was used for S3A willalready have counted down to zero, and hence, no reset is needed.

The manner in which the state table for the multi-symbol FSM isconstructed from the base FSM will now be explained in more detail. Thenumber of possible input words for a w symbol wide FSM is N_(s) ^(W),where N_(s) is the number of single step symbols. In the currentexample, 4=2 and Ns=3; hence, there are nine possible two symbol inputwords. For each state and each possible input word, the path starting atthe state and traversed by the mini-path represented by that input wordis determined with reference to the base FSM. For example, if thecurrent state is S0 and the input word LM is received, the next statewill be S2, as the FSM first transitions to S1 on the first symbol andthen to S2 on the second symbol. If the FSM is currently at S2 and XH isreceived, the FSM will transition to S3A and decrement the counter. Ifon the other hand, HH was received, the FSM would transition to S3B andthen decrement the counter.

Refer now to Table 3, which is the state table for the regularexpression shown in Table 1 for a word size of two symbols per FSM clockcycle.

TABLE 3 State Table for [{circumflex over ( )}L] * L + M * H{m}M * Lwith w = 2. S5 S0 S1 S2 S3A S3B S4 (Match) Input x ✓ x ✓ x ✓ x ✓ x ✓ x ✓x ✓ LL 1 1 1 1 1 1 6 6 — LM 2 2 2 2 0 2 6 6 — LH 3 3 3 3 0 3 6 6 — ML 11 1 1 0 1 6 6 — MM 0 2 2 0 0 0 0 5 — MH 0 3 3 0 0 0 0 0 — HL 1 1 1 1 6 10 1 — HM 0 0 0 0 5 0 0 0 — HH 0 4 4 3 0 4 0 0 —

The above described embodiments refer to a counter whose contents areexamined to determine if a count condition has been satisfied. If asingle count register is utilized, the register can be incremented untilit matches a value stored in another register, e.g., m/w-1.Alternatively, the register can be reset to the desired value anddecremented on each clock cycle. This second alternative is preferredbecause testing the contents of the register for zero can be done moreeconomically.

For counted states of the third type, i.e., {m,n}, a single counter canalso be utilized. The counter is first loaded with the valuecorresponding to m, and the flag that indicates that the count conditionhas been achieved is set to false. After the counter counts down tozero, the counter is reset to the value corresponding to n, and the flagis set to true. When the counter again counts down to zero, the flag isreset to false.

Alternately, a two register counter could be utilized in which the firstregister is loaded with a value related to m and the second is loadedwith a value related to n. Two flags are used to keep track of whetherthe count condition is satisfied, and if not, which non-satisfied stateis present, i.e., count below the m value or above the n value.

The present invention is preferably implemented in custom computerhardware to provide the desired speed. Refer now to FIG. 5, whichillustrates the portion of the hardware that implements an FSM accordingto the present invention. The state table for FSM processor 30 is storedin a memory 35 which is loaded by trigger generator 16 shown in FIG. 1.The type of trigger is specified by the user input to trigger generator16. The symbols of the current word are loaded into a current input wordgenerator 32 which together with the current state of the FSM which isstored in register 33 to determine an address in memory 35 at which thenext state values for the count satisfied and count not satisfiedentries are located together with any information associated with thenext state such as reset values for the counter and flags that determinewhich of the two entries is to be used. The choice of column is made bycontroller 38 which generates a selection signal that is input tomultiplexer 36 which receives the two possible values.

Controller 38 controls counter 37. Controller 38 receives signalsdefining the count mode and the values to be loaded into counter 37 whenthe counter is reset. Controller 38 loads a starting value into counter37 when required either by the start of the trigger or resetinstructions associated with the next state output from multiplexer 36.Counter 37 is decremented on each clock cycle and controller 38 teststhe contents of counter 37 to determine if the count stored therein isnow zero. Controller 38 also includes the flags discussed above. Thefirst flag determines if the count condition specified by the mode andvalues of m and n has been satisfied. Controller 38 also sets the secondflag needed to process a {m,n} count condition.

As noted above, a trigger generator according to the present inventionmay include a number of counters. In many cases of interest such as theglitch sequence trigger, a single hardware counter is sufficient, sinceonly one counting state is operating at any time. However, a state tablewith more than one active counter could be utilized for a particulartrigger sequence. In this case, counter 37 would be replaced by aplurality of counters and the current state would specify which counteris to be used for that state transition.

To simplify the address generation, each state in the state table isassigned two next state entries for each possible input word. If thestate does not depend on the count in counter 37, both entries areidentical. Alternatively, controller 38 can be programmed to take thefirst of the two entries unless the current state is a counting state.Strategies to remove this redundant information via compressiontechniques can also be employed.

Refer again to FIG. 1. As noted above, the ADCs 12 operate in banks toachieve the necessary throughput for a high speed instrument. In oneaspect of the invention, the symbol generator 15 also includes a bank ofsymbol generators that create a corresponding group of symbols thatbecome the input symbols to the multi-symbol FSM of the presentinvention. For example, an instrument having a bank of 16 ADCs generates16 consecutive time samples each FSM clock cycle. These 16 time samplesare then converted to 16 consecutive symbols that are loaded into theinput word trigger generator 16. The FSM clockperiod is set to be lessthan or equal to the clock in the ADCs in embodiments in which the FSMprovides a real time trigger.

To achieve the desired trigger speeds, the number of symbols in an inputword must at least match the number of symbols generated by the bank ofADCs in the instrument. The amount of memory needed to store the statetable increases exponentially with the number of symbols in themulti-symbol input word to the FSM. Hence, FSM designs that reduce thememory requirements are preferred.

Refer again to the FSM shown in FIG. 3A. With a one symbol input word,the state table for this FSM has three rows and ten columns inembodiments in which each state stores a two entry next symbol value.The corresponding FSM with a 16 symbol input word requires 3¹⁶ rows and30 columns corresponding to the 15 states. The maximum number ofdifferent rows that can be created from the 30 columns is less than 30²or 900, since the four columns are identical for the non-counted states.Hence, the state tables must have a large number of cases in which therow for one input word is the same as the row for another input wordwith the exception of the input word in the first column. Thisredundancy can be used to reduce the size of the memory needed bystoring a reduced table that has only the unique rows with the inputword replaced by a key value. A correspondence table that stores thecorrespondence between the input words and the key values is then usedto access the reduced table. The correspondence table has one columnthat is indexed by the input word. Hence, this compressed version of thestate table reduces the memory requirements by roughly a factor of 30 atthe expense of a table lookup that is performed in address generator 34shown in FIG. 5.

This form of table compression is particularly well suited to the typeof state table generated by multi-symbol FSMs. However, other forms oftable compression could also be utilized to further reduce the size ofthe state table.

The above-described embodiments of the present invention utilize MooreFSMs in which the FSM stops when a match is found. In a Moore FSM, theoutput values are determined solely by the current state of the FSM.That is, the FSM reports a match when it enters a state no matter how itgot to that state. In a Mealy machine, the output depends on the currentstate and the current inputs. Hence, a Mealy machine reports on aparticular edge being taken. In a Mealy machine, a state may report amatch if entered by one edge, but not if entered by another edge. Mealymachines can also be used for implementing the present invention. Fortriggers in which the trigger is to operate continually withoutresetting, a Mealy FSM is preferred. First, a non-stopping trigger canhave transitioned through a matching state on a w-symbol path, whilereporting on the edge that passes through the matching state. Secondly,the Mealy machine is more compact. Third, a Mealy machine can be made tomatch and return to the start state all in one transition. For example,in a Moore machine which repeats S5 is both a match state and the nextpass through the start state, which is not ideal.

In a Mealy FSM embodiment of the present invention, the edges carry theinformation about incrementing counters and whether a match has occurredinstead of associating this information with entering a particularstate. The Mealy FSM embodiments are also generated from a base FSM.Each state of the multi-symbol FSM corresponds to a w-symbol path withinthe base FSM. An intermediate stop on that path may trigger a countoperation or match report. Hence, the two edges that terminate on thesame state in the base FSM can correspond to different counting andreporting behaviors even though the two paths end on the same state.

As noted above, a multi-symbol FSM counting state counts in units of theword size. That is m and n must be divisible by the word size w, and thecounters are incremented or decremented by w. If an m or n value that isnot a multiple of w is desired, the state table can be augmented toinclude the appropriate number of additional states that consume theneeded symbols. The state table can be constructed from a base FSM byinserting one or more additional states that are entered on the receiptof another symbol of the type being counted. Refer now to FIG. 6, whichillustrates a base FSM for a two symbol input word FSM that counts anodd number of Hs. The base FSM is obtained by adding the state S6 afterstate S3B. Hence, one additional H must be received before the triggerfires. Alternatively, the additional states could be added before S3Aand/or after S3A. For an {m,} counter, the extra states are added beforeS3A. For an {m,n} counter, the states may have to be added both beforeS3A and after S3B depending upon the required values of m and n. Forvalues of n which are smaller than m plus w additional symbols thenadditional states can also be utilized instead of the second counter toconstruct an FSM that counts correctly, for example between values ofm=33 and n=35 on a four symbol per clock FSM.

The FSM of the present invention is preferably implemented in specialpurpose hardware to provide the speed needed to implement a real-timetrigger for a high speed oscilloscope or similar instrument. However,embodiments could be implemented on general purpose data processingsystems if the speed of the incoming data stream was sufficiently low.

The above-described embodiments of the present invention have beenprovided to illustrate various aspects of the invention. However, it isto be understood that different aspects of the present invention thatare shown in different specific embodiments can be combined to provideother embodiments of the present invention. In addition, variousmodifications to the present invention will become apparent from theforegoing description and accompanying drawings. Accordingly, thepresent invention is to be limited solely by the scope of the followingclaims.

What is claimed is:
 1. An apparatus comprising: a symbol generator thatreceives an ordered sequence of signal values and converts said orderedsequence of signal values into an ordered sequence of symbols, eachsymbol having a plurality of states; and a finite state machine (FSM)that receives said ordered sequence of symbols and generates a matchsignal if said ordered sequence of symbols includes a target sequencespecified by a regular expression that includes a counting limitationfor one of said symbols, wherein said FSM includes a counting stateincluding a counter that counts instances of said one of said symbol. 2.The apparatus of claim 1 wherein said FSM is characterized by an inputword and an FSM clock period, and wherein said FSM processes said inputword during each FSM clock period, said input word comprising aplurality of said symbols.
 3. The apparatus of claim 1 wherein saidcounting limitation comprises a requirement that a precise number ofinstances of one of said symbol states be present in said targetsequence.
 4. The apparatus of claim 1 wherein said counting limitationcomprises a requirement that more than a specified number of instancesof one of said symbol states be present in said target sequence.
 5. Theapparatus of claim 1 wherein said counting limitation comprises arequirement that more than a first specified number of said instances ofone of said symbol states and less than a second specified number ofsaid instances of said one of said symbols be present in said targetsequence.
 6. The apparatus of claim 1 wherein said FSM has a memory thatstores a state table that specifies a next state for said FSM based on apresent state for said FSM and said input word currently being processedby said FSM, said state table specifying first and second next statesfor said FSM when said FSM is in said counting state, said FSM choosingone of said first and second next states based on whether said countinglimitation has been satisfied.
 7. The apparatus of claim 6 wherein saidcounting limitation is not satisfied if said counter has a value lessthan a first value or greater than a second value, and wherein said oneof said first and second next states that said FSM chooses also dependson whether said counter is less than said first value or greater thansaid second value.
 8. The apparatus of claim 1 further comprising asignal digitizer and a signal memory, said signal digitizer receiving asignal and generating said ordered sequence of signal values therefrom,said ordered sequence of signal values being stored in said signalmemory.
 9. The apparatus of claim 8 wherein said signal digitizergenerates a first number of signal values during each FSM clock period,each of said first number of signal values being converted to acorresponding symbol during one FSM clock period, and wherein said FSMprocesses said corresponding symbols as a single input word during oneFSM clock period.
 10. The apparatus of claim 8 further comprising adisplay controller and a display, said display controller displaying aportion of said signal values on said display in response to said FSMgenerating said match signal.
 11. The apparatus of claim 1 wherein saidFSM is a Mealy FSM.
 12. A method for operating a data processing systemto detect a signal pattern in a signal comprising an ordered sequence ofsignal values, said method comprising: converting said ordered sequenceof signal values and converts said ordered sequence of signal valuesinto an ordered sequence of symbols, each symbol having a plurality ofstates; and implementing an FSM in said data processing system, said FSMreceiving said ordered sequence of symbols and generating a match signalif said ordered sequence of symbols includes a target sequence specifiedby a regular expression that includes a counting limitation for one ofsaid symbols, wherein said FSM includes a counting state including acounter that counts instances of said one of said symbol.
 13. The methodof claim 12 wherein said FSM is characterized by an input word and anFSM clock period, and wherein said FSM processes said input word duringeach FSM clock period, said input word comprising a plurality of saidsymbols.
 14. The method of claim 12 wherein said counting limitationcomprises a requirement that a precise number of instances of one ofsaid symbol states be present in said target sequence.
 15. The method ofclaim 12 wherein said counting limitation comprises a requirement thatmore than a specified number of instances of one of said symbol statesbe present in said target sequence.
 16. The method of claim 12 whereinsaid counting limitation comprises a requirement that more than a firstspecified number of said instances of one of said symbol states and lessthan a second specified number of said instances of said one of saidsymbols be present in said target sequence.
 17. The method of claim 1wherein said FSM has a memory that stores a state table that specifies anext state for said FSM based on a present state for said FSM and saidinput word currently being processed by said FSM, said state tablespecifying first and second next states for said FSM when said FSM is insaid counting state, said FSM choosing one of said first and second nextstates based on whether said counting limitation has been satisfied. 18.The method of claim 17 wherein said counting limitation is not satisfiedif said counter has a value less than a first value or greater than asecond value, and wherein said one of said first and second next statesthat said FSM chooses also depends on whether said counter is less thansaid first value or greater than said second value.
 19. The method ofclaim 12 further comprising a signal digitizer and a signal memory, saidsignal digitizer receiving a signal and generating said ordered sequenceof signal values therefrom, said ordered sequence of signal values beingstored in said signal memory.
 20. The method of claim 9 wherein saidsignal digitizer generates a first number of signal values during eachFSM clock period, each of said first number of signal values beingconverted to a corresponding symbol during one FSM clock period, andwherein said FSM processes said corresponding symbols as a single inputword during one FSM clock period.